package com.laboratory.manage.utils;

import java.io.File;

public class FileUtils {

    //获取路径
    public static String extractDirectory(String path) {
        File file = new File(path);
        return file.getParent();
    }

    // 获取文件扩展名
    public static String getFileExtension(File file) {
        String extension = "";
        String fileName = file.getName();
        int dotIndex = fileName.lastIndexOf(".");
        if (dotIndex >= 0 && dotIndex < fileName.length() - 1) {
            extension = fileName.substring(dotIndex);
        }
        return extension;
    }
}
